<?php
require_once('config.php');
require_once('database.php');


class Auth extends MySQLDatabase{
	
	
	public function __construct(){
	}

	public static function authenticate_user($username, $password){
	
		global $database;
		$sql = "SELECT username, password FROM users ";
		$sql .= "WHERE username ='" . $username . "' ";
		$sql .= "AND password ='" . $password . "'";
		

		$result_set = $database->query($sql);
		if(!$result_set){
			
			die(mysql_error());
		
		}
		
		if($database->num_rows($result_set) == 1){
			
			return TRUE;
			//$is_logged_in = TRUE;
			//return TRUE;
		
		} 
		return FALSE;
	}
}

$auth = new Auth();